import java.util.Scanner;

public class Practice2 {
    //https://www.nowcoder.com/questionTerminal/b2b816e20e8343b49abbaf493886ce26
    //也没做出来, 注意数据大小
    static char[] ss1 ;
    static char[] ss2 ;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ss1 = sc.next().toCharArray();
        ss2 = sc.next().toCharArray();
        int n = ss2.length - ss1.length;
        int ret = Integer.MAX_VALUE;
        for(int i = 0;i <= n;i++){
            ret = Math.min(check(i),ret);
        }
        System.out.println(ret);
    }

    private static int check(int k) {
        int m = 0;
        int count = 0;
        for (int i = k; i < ss1.length + k; i++) {
            if(ss2[i] != ss1[m++]){
                count++;
            }
        }
        return count;
    }
}
